package fr.afcepf.qualimetrie.banque_calculEmpruntData;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

@Stateless
public class CalculEmpruntData implements ICalculEmpruntData {

	@PersistenceContext
	EntityManager manager;
	/* (non-Javadoc)
	 * @see fr.afcepf.qualimetrie.banque_calculEmpruntData.ICalculEmpruntData#getTauxInteretCourant(int)
	 */
	public double getTauxInteretCourant(int nb_mois) {
		Query q = manager.createQuery("SELECT f FROM Fraisdossier f");
		Fraisdossier d  = (Fraisdossier)q.getResultList().get(1);
		return d.getFrais();
	}
	/* (non-Javadoc)
	 * @see fr.afcepf.qualimetrie.banque_calculEmpruntData.ICalculEmpruntData#getFraisDossier(double)
	 */
	public double  getFraisDossier(double montant) {
		Query q = manager.createQuery("SELECT f FROM Fraisdossier f");
		Fraisdossier d  = (Fraisdossier)q.getResultList().get(0);
		return d.getFrais();
	}
}
